package com.cetccst.securitysuite.fragments;

import android.os.Bundle;

import com.cetccst.securitysuite.BR;
import com.cetccst.securitysuite.R;
import com.cetccst.securitysuite.databinding.FragmentMainBinding;
import com.cetccst.securitysuite.fragments.viewmodel.MainViewModel;
import cn.com.cetccst.uicomponents.binding.app.DataBindingConfig;

public class MainFragment extends BaseFragment<FragmentMainBinding> {

    private MainViewModel viewModel;

    @Override
    protected void initViewModel() {
        viewModel = getFragmentScopeViewModel(MainViewModel.class);
        viewModel.initialize(this);
    }

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        viewModel.postAppDataPeriodically();
    }

    @Override
    protected DataBindingConfig getDataBindingConfig() {
        return new DataBindingConfig(R.layout.fragment_main, BR.viewModel, viewModel);
    }
}